package com.zoweunion.mechanic.util.constants;

import java.util.stream.IntStream;

public class Constants {

	// ==========================中惠超级管理员账号=============================
	public static final String[] SUPER_ADMIN = new String[] {"13861888505","13771159964"};

	// ==========================demo账号的s_id=============================
	public static final String[] DEMO_ACCOUNT_S_ID = new String[] {"be7bf99ac18a42bdb1f534c85497e227"};

	// ==========================响应状态=============================
	public static int CODE_SUCCESS = 10000;// 调用成功
	public static int CODE_ERROR = 10001;// 调用失败
	public static int CODE_HANDEL_FAILED = 10002;// 业务操作失败
	public static int CODE_NOT_FIELD = 10003;// 参数错误
	public static int CODE_ACCESS_PROHIBITED = 401;// 访问拒绝
	public static int CODE_NOT_ALLOWED_LOGIN_IC = 10010; //没有登录后市场权限

	// ==========================服务商s_id=============================
	public static String catSId = "6bd970ddd3e44e0f8646f951453ce18e"; // 卡特彼勒服务商
	public static String catMoNiSId = "673c2b7e0674483d820f4fc45cc0391d"; // 卡特彼勒模拟
	public static String wxztSId = "a892450bd6084f4484a5479e0a9c1b23"; // 无锡市钻通服务商

	public static String wxtkjMoNiSId = "928d657af88d45398ff9760f2c391834"; // 江苏省无锡探矿机械总厂有限公司

		public static String hxdlSId = "59fc983dffe743d288a41971de54913c"; // 灰熊动力的sid 正式服 这个算是pid
//	public static String hxdlSId = "9bd92242a7ad42a0b02d413452325291"; // 灰熊动力的sid 测试服
	public static String hxdlSIdPid = "fb31f81fed1c48659ff18f4d8221a390"; // 灰熊动力的sid的父id 测试服

	// ========================== 合锻智能登高车服务商 start =============================
	public static String hdznSId = "4579dfc30a5f41cd9cb777b68728fa38"; // 合锻智能登高车服务商的sid

	public static String getZTKZZ1Result(String binaryStr) {
		final char key = "1".charAt(0);
		int[] indices = IntStream.range(0, binaryStr.length())
				.filter(i -> binaryStr.charAt(i) == key)
				.toArray();
		String dataStr = "";
		for(int i =0; i< indices.length; i++) {
			switch (indices[i]) {
				case 0:
					dataStr += "前进阀 ";
					break;
				case 1:
					dataStr += "后退阀 ";
					break;
				case 2:
					dataStr += "上升阀 ";
					break;
				case 3:
					dataStr += "下降阀 ";
					break;
				case 4:
					dataStr += "右转阀 ";
					break;
				case 5:
					dataStr += "左转阀 ";
					break;
				case 7:
					dataStr += "电机使能 ";
					break;
			}
		}

		return dataStr;
	}

	public static String getZTKZZ2Result(String binaryStr) {
		final char key = "1".charAt(0);
		int[] indices = IntStream.range(0, binaryStr.length())
				.filter(i -> binaryStr.charAt(i) == key)
				.toArray();
		String dataStr = "";
		for(int i =0; i< indices.length; i++) {
			switch (indices[i]) {
				case 0:
					dataStr += "底盘喇叭 ";
					break;
				case 2:
					dataStr += "底盘LED ";
					break;
				case 3:
					dataStr += "底盘蜂鸣器 ";
					break;
			}
		}

		return dataStr;
	}

	public static String getKGZT1Result(String binaryStr) {
		final char key = "1".charAt(0);
		int[] indices = IntStream.range(0, binaryStr.length())
				.filter(i -> binaryStr.charAt(i) == key)
				.toArray();
		String dataStr = "";
		for(int i =0; i< indices.length; i++) {
			switch (indices[i]) {
				case 2:
					dataStr += "下空下降开关 ";
					break;
				case 4:
					dataStr += "上限位开关 ";
					break;
				case 5:
					dataStr += "下限位开关 ";
					break;
				case 6:
					dataStr += "过载开关 ";
					break;
			}
		}

		return dataStr;
	}

	public static String getKGZT2Result(String binaryStr) {
		final char key = "1".charAt(0);
		int[] indices = IntStream.range(0, binaryStr.length())
				.filter(i -> binaryStr.charAt(i) == key)
				.toArray();
		String dataStr = "";
		for(int i =0; i< indices.length; i++) {
			switch (indices[i]) {
				case 0:
					dataStr += "坑洞保护 ";
					break;
				case 1:
					dataStr += "上下控开关 ";
					break;
				case 2:
					dataStr += "下控上升开关 ";
					break;
				case 7:
					dataStr += "倾斜开关 ";
					break;
			}
		}

		return dataStr;
	}

	public static String getSBAJZTResult(String binaryStr) {
		final char key = "1".charAt(0);
		int[] indices = IntStream.range(0, binaryStr.length())
				.filter(i -> binaryStr.charAt(i) == key)
				.toArray();
		String dataStr = "";
		for(int i =0; i< indices.length; i++) {
			switch (indices[i]) {
				case 0:
					dataStr += "龟速按钮 ";
					break;
				case 1:
					dataStr += "喇叭按钮 ";
					break;
				case 2:
					dataStr += "使能按钮 ";
					break;
				case 3:
					dataStr += "右转按钮 ";
					break;
				case 4:
					dataStr += "左转按钮 ";
					break;
				case 5:
					dataStr += "升降模式按钮 ";
					break;
				case 6:
					dataStr += "行走模式按钮 ";
					break;
			}
		}

		return dataStr;
	}

	public static String getJCCZTResult(String binaryStr) {
		final char key = "1".charAt(0);
		int[] indices = IntStream.range(0, binaryStr.length())
				.filter(i -> binaryStr.charAt(i) == key)
				.toArray();
		String dataStr = "";
		for(int i =0; i< indices.length; i++) {
			switch (indices[i]) {
				case 0:
					dataStr += "初始化 ";
					break;
				case 1:
					dataStr += "建立通信连接 ";
					break;
				case 2:
					dataStr += "正常运行 ";
					break;
				case 3:
					dataStr += "释放刹车 ";
					break;
				case 4:
					dataStr += "故障锁机 ";
					break;
				case 5:
					dataStr += "车辆维护 ";
					break;
				case 6:
					dataStr += "PC模式 ";
					break;
			}
		}

		return dataStr;
	}

	public static String getJCCGZ1Result(String binaryStr) {
		final char key = "1".charAt(0);
		int[] indices = IntStream.range(0, binaryStr.length())
				.filter(i -> binaryStr.charAt(i) == key)
				.toArray();
		String dataStr = "";
		for(int i =0; i< indices.length; i++) {
			switch (indices[i]) {
				case 0:
					dataStr += "系统初始化失败 ";
					break;
				case 1:
					dataStr += "系统通信故障 ";
					break;
				case 2:
					dataStr += "控制选项错误 ";
					break;
				case 3:
					dataStr += "底盘控制开关故障 ";
					break;
				case 4:
					dataStr += "坑洞保护故障 ";
					break;
				case 5:
					dataStr += "压力传感器故障 ";
					break;
				case 6:
					dataStr += "角度传感器故障 ";
					break;
				case 7:
					dataStr += "平台左转按钮故障 ";
					break;
			}
		}

		return dataStr;
	}

	public static String getJCCGZ2Result(String binaryStr) {
		final char key = "1".charAt(0);
		int[] indices = IntStream.range(0, binaryStr.length())
				.filter(i -> binaryStr.charAt(i) == key)
				.toArray();
		String dataStr = "";
		for(int i =0; i< indices.length; i++) {
			switch (indices[i]) {
				case 0:
					dataStr += "平台右转按钮故障 ";
					break;
				case 1:
					dataStr += "平台使能按钮故障 ";
					break;
				case 2:
					dataStr += "平台手柄中点偏移 ";
					break;
				case 3:
					dataStr += "电池电压低故障 ";
					break;
				case 4:
					dataStr += "平台过载故障 ";
					break;
				case 5:
					dataStr += "车体倾斜故障 ";
					break;
				case 6:
					dataStr += "GPS通信故障 ";
					break;
			}
		}

		return dataStr;
	}

	public static String getJCCGZ3Result(String binaryStr) {
		final char key = "1".charAt(0);
		int[] indices = IntStream.range(0, binaryStr.length())
				.filter(i -> binaryStr.charAt(i) == key)
				.toArray();
		String dataStr = "";
		for(int i =0; i< indices.length; i++) {
			switch (indices[i]) {
				case 0:
					dataStr += "前进阀门故障 ";
					break;
				case 1:
					dataStr += "后退阀门故障 ";
					break;
				case 2:
					dataStr += "上升阀门故障 ";
					break;
				case 3:
					dataStr += "下降阀门故障 ";
					break;
				case 4:
					dataStr += "刹车阀门故障 ";
					break;
				case 5:
					dataStr += "右转阀门故障 ";
					break;
				case 6:
					dataStr += "左转阀门故障 ";
					break;
			}
		}

		return dataStr;
	}

	public static String getLockStatusResult(String binaryStr) {
		final char key = "1".charAt(0);
		int[] indices = IntStream.range(0, binaryStr.length())
				.filter(i -> binaryStr.charAt(i) == key)
				.toArray();
		String dataStr = "";
		for(int i =0; i< indices.length; i++) {
			switch (indices[i]) {
				case 0:
					dataStr += "一级锁车命令 ";
					break;
				case 1:
					dataStr += "二级锁车命令 ";
					break;
			}
		}

		return dataStr;
	}
	// ========================== 合锻智能登高车服务商 end =============================

	// ==========================环卫s_id=============================
	public static String envSId = "8276d768637d4bb5ad8bd5fc6867cf2f"; // 环卫服务商

	// ==========================redis 卡特在线的key=============================
	public static String CATOnlineThings = "CATOnlineThings_";
	public static String CATMoNiThings = "CATMoNiThings_";

	// ==========================角色类型=============================
	public static String ROLE_KF = "1";// 客服
	public static String ROLE_TZ = "2";// 听诊
	public static String ROLE_XG = "3";// 修工
	public static String ROLE_CG = "4";// 仓管
	public static String ROLE_CZ = "5";// 车主
	public static String ROLE_SJ = "6";// 司机
	public static String ROLE_GLY = "7";//管理员
	public static String ROLE_GG = "8";// 高管
	public static String ROLE_YK = "9";// 游客
	public static String ROLE_XS = "10";//销售
	public static String ROLE_CW = "11";//财务

	// =========================订单类型=============================
	public static int ORDER_STATUS_WAIT_PAY= 1;// 未付款
	public static int ORDER_STATUS_WAIT_AUDIT = 2;// 待审核
	public static int ORDER_STATUS_PASS_AUDIT = 3;// 审核成功
	public static int ORDER_STATUS_PASS = 4;// 待发货
	public static int ORDER_STATUS_DELIVER = 5;// 已发货
	public static int ORDER_STATUS_FINISH = 6;// 完成

	// =======================付款的订单类型=============================
	public static int ORDER_WORK = 1;// 工单
	public static int ORDER_CERTIFICATE = 2;// 操作证
	public static int ORDER_INSURANCE = 3;// 保险

	// =========================订单类型状态文字=============================
	public static String ORDER_STATUS_WAIT_PAY_TEXT= "已填写信息，等待付款";
	public static String ORDER_STATUS_WAIT_AUDIT_TEXT = "已经付款，审核中";
	public static String ORDER_STATUS_FAIL_AUDIT_TEXT = "审核未通过";
	public static String ORDER_STATUS_PASS_AUDIT_TEXT = "审核通过";
	public static String ORDER_STATUS_PASS_TEXT = "待发货";
	public static String ORDER_STATUS_DELIVER_TEXT = "已发货";
	public static String ORDER_STATUS_FINISH_TEXT = "完成";

	// =========================订单考核类型=============================
	public static int ORDER_CHECK_KF_RESPONSE= 1;// 客服响应
	public static int ORDER_CHECK_KF_TAKE_ORDER = 2;// 客服接单
	public static int ORDER_CHECK_TZ_RESPONSE = 3;// 听诊响应
	public static int ORDER_CHECK_TZ_PARTS = 4;// 配件错误
	public static int ORDER_CHECK_TZ_FINISH = 5;// 及时完成听诊
	public static int ORDER_CHECK_CG_RESPONSE = 6;// 仓管响应
	public static int ORDER_CHECK_CG_PASTS_RESPONSE= 7;// 仓管准备配件
	public static int ORDER_CHECK_CG_PARTS_IN = 8;// 仓管返件入库
	public static int ORDER_CHECK_XG_RESPONSE = 9;// 修工响应
	public static int ORDER_CHECK_XG_RECEIVE_PARTS = 10;// 修工领取
	public static int ORDER_CHECK_XG_ROUTE = 11;// 修工行程时间
	public static int ORDER_CHECK_XG_PREPARE_CONFIRM = 12;// 维修前确认
	public static int ORDER_CHECK_XG_REPAIR_TIME = 13;// 维修确认
	public static int ORDER_CHECK_XG_PAY_FINISH = 14;// 完成支付
	public static int ORDER_CHECK_XG_CLIENT_APPRISE = 15;// 客户评价
	public static int ORDER_CHECK_XG_PAY_DELAY = 16;// 支付延迟
	public static int ORDER_CHECK_XG_PASTS_RESPONSE = 17;// 修工配件返库

	// =========================保险=============================
	public static final String INSURANCE_PHONE = "18438610359";// 保险商电话

	public enum InsuranceEnum{
		/**
		 * 保险
		 */
		WAIT_PRICE(1,"【用户】已填写信息，等待报价"),
		WAIT_PRICE_FAIL(2,"您的申请未通过，点击查看详情"),
		WAIT_PRICE_PASS(3,"您的申请已通过，请点击前去支付"),
		USER_CONFIRM(4,"【用户】用户已付款，等待商家审核"),
		WAIT_DELIVER(6,"保险方已确认您已付款"),
		STATUS_DELIVER(7,"您的保单已发货，请注意查收"),
		STATUS_FINISH(8,"您的订单已完成！"),
		WAIT_FINISH_ADMIN(10,"【管理员】待完成"),
		WAIT_FINISH_AUDIT(11,"【审核人员】待完成");



		/** code */
		private Integer code;
		/** 描述 */
		private String name;
		InsuranceEnum(Integer code, String name){
			this.code = code;
			this.name = name;
		}

		public static String getRoleName(Integer code) {
			InsuranceEnum[] insuranceEnums = values();
			for (InsuranceEnum insuranceEnum : insuranceEnums) {
				if (insuranceEnum.getCode() == code) {
					return insuranceEnum.getName();
				}
			}
			return null;
		}

		public Integer getCode() {
			return code;
		}

		public void setCode(Integer code) {
			this.code = code;
		}

		public String getName() {
			return name;
		}

		public void setName(String name) {
			this.name = name;
		}
	}


	public enum RoleEnum{
		/**发动机厂家*/
		ROLE_KF("1", "客服"),
		ROLE_TZ("2", "听诊"),
		ROLE_XG("3", "修工"),
		ROLE_CG("4", "仓管"),
		ROLE_CZ("5", "车主"),
		ROLE_SJ("6", "司机"),
		ROLE_GLY("7", "管理员"),
		ROLE_GG("8", "高管"),
		ROLE_YK("9", "游客"),
		ROLE_XS("10", "销售"),
		ROLE_CW("11", "财务");


		/** code */
		private String code;
		/** 描述 */
		private String name;
		RoleEnum(String code, String name){
			this.code = code;
			this.name = name;
		}

		public static String getRoleName(String code) {
			RoleEnum[] roleEnums = values();
			for (RoleEnum roleEnum : roleEnums) {
				if (roleEnum.getCode().equals(code)) {
					return roleEnum.getName();
				}
			}
			return null;
		}

		public String getCode() {
			return code;
		}

		public void setCode(String code) {
			this.code = code;
		}

		public String getName() {
			return name;
		}

		public void setName(String name) {
			this.name = name;
		}
	}

	// ==========================工单类型=============================
	public static int ORDER_TYEP_WX = 1;// 维修
	public static int ORDER_TYEP_BY = 2;// 保养
	public static int ORDER_TYEP_WXBY = 3;// 维修+保养
	public static int ORDER_TYEP_FX = 4;// 返修

	// ==========================推送级别=============================
	public static int PUSH_LEVEL_ONE = 1;// 1
	public static int PUSH_LEVEL_TWO = 2;// 2
	public static int PUSH_LEVEL_THREE = 3;// 3

	// ==========================故障类型=============================
	public static String DICTIONARIES_NAME_DL = "动力系统";
	public static String DICTIONARIES_NAME_YA = "液压系统";
	public static String DICTIONARIES_NAME_DQ = "电气系统";
	public static String DICTIONARIES_NAME_GZ = "工作装置";
	public static String DICTIONARIES_NAME_XZ = "行走装置";
	public static String DICTIONARIES_NAME_QT = "其他";

	// ==========================工单状态=============================
	public static int ORDER_STATUS_CZQR = 1;// 待车主确认
	public static int ORDER_STATUS_DSL = 2;// 待受理
	public static int ORDER_STATUS_DTZ = 3;// 待听诊
	public static int ORDER_STATUS_YTZ = 4;// 已听诊
	public static int ORDER_STATUS_PJ = 5;// 待配件
	public static int ORDER_STATUS_DLL = 6;// 待领料
	public static int ORDER_STATUS_YLL = 7;// 已领料
	public static int ORDER_STATUS_QWXC = 8;// 前往现场
	public static int ORDER_STATUS_DDXC = 9;// 到达现场
	public static int ORDER_STATUS_QRFA = 10;// 确认方案
	public static int ORDER_STATUS_ZJ = 11;// 自检
	public static int ORDER_STATUS_HJ = 12;// 互检
	public static int ORDER_STATUS_WXJS = 13;// 维修结束
	public static int ORDER_STATUS_QRJS = 14;// 确认结束
	public static int ORDER_STATUS_DZF = 15;// 待支付
	public static int ORDER_STATUS_QRSK = 16;// 确认收款（只针对现金）
	public static int ORDER_STATUS_DPJ = 17;// 待评价
	public static int ORDER_STATUS_WC = 18;// 完成
	public static int ORDER_STATUS_TZWC = 181;// 听诊完成
	public static int ORDER_STATUS_FX = 100;// 第一次返修
	public static int ORDER_STATUS_FX_QWXC = 108;// 第一次返修 前往现场
	public static int ORDER_STATUS_FX_DDXC = 109;// 第一次返修 到达现场
	public static int ORDER_STATUS_FX_QRFA = 110;// 第一次返修 确认方案
	public static int ORDER_STATUS_FX_ZJ = 111;// 第一次返修 自检
	public static int ORDER_STATUS_FX_WC = 118;// 第一次返修 完成
	public static int ORDER_STATUS_ECFX = 200;// 第二次返修
	public static int ORDER_STATUS_ECFX_DTZ = 203;// 第二次返修 待听诊,没客服，应该不需要了
	public static int ORDER_STATUS_ECFX_YTZ = 204;// 第二次返修 已听诊

	// ==========================字典类型=============================
	public static String MAINTENANCE_SCHEDULE_CZ = "1";
	public static String MAINTENANCE_SCHEDULE_JJFA = "2";
	public static String MAINTENANCE_SCHEDULE_ZJ = "1";

	// ==========================配件增减标识=============================
	public static String PARTS_REALTIME = "0";
	public static String PARTS_ADD = "1";
	public static String PARTS_MINUS = "2";

	// ==========================支付类型=============================
	public static String PAY_TYPE_XY="1";//信用支付
	public static String PAY_TYPE_WX="2";//微信
	public static String PAY_TYPE_ZFB="3";//支付宝
	public static String PAY_TYPE_XJ="4";//现金

	// ==========================物联网=============================
	public static String THINGS_URL_ALL = "https://cloud.zoweunion.com/API/System/MSCS/Facility?type=node";
	public static String THINGS_URL_ONE = "https://cloud.zoweunion.com/API/System/MSCS/Facility?type=node&opcpath=";
	public static String THINGS_HIS_URL = "https://cloud.zoweunion.com/API/System/MSCS/Mining/History?";
	public static final String RUNHOURS = "运行小时";
	// ==========================环卫=============================
	public static String ENVIRONMENTAL = "http://61.177.139.232:28069/api/WebApi/GPS/SendSanitationGRSInfo";

	// 实时数据常量
	public static final String THINGS_FuelGauge = "FuelGauge";
	public static final String THINGS_OperatingHours = "OperatingHours"; // 发动机总时长
	public static final String THINGS_GPSlongitude = "GPSlongitude";
	public static final String THINGS_GPSlatitude = "GPSlatitude";
	public static final String THINGS_CSQ = "CSQ"; // 信号强度
	public static final String THINGS_BatVol = "BatVol";
	public static final String WORK_HOUR = "workHour"; // 工作时长
	public static final String THINGS_Sample_time = "sample_time";
	public static final String THINGS_Ignition = "Ignition"; // 点火
	public static final String THINGS_Location_mode = "Location_mode"; // 定位模式
	public static final String THINGS_TotalFuelAmount = "TotalFuelAmount";
	public static final String THINGS_CAN_OK = "CAN_OK"; // can线的数据
	public static final String THINGS_IsCAT = "isCAT"; // 是否为卡特设备
	public static final String THINGS_ValidRotateSpeed = "validRotateSpeed"; // 是否有转速
	public static final String THINGS_EngineTotalHours = "EngineTotalHours"; // 发动机总时长
	public static final String THINGS_18010 = "18010"; // 铝壳版180

	/** 水温 */
	public static final String THINGS_WaterTemperature = "WaterTemperature";
	/** 发动机转速 */
	public static final String THINGS_RotateSpeed = "RotateSpeed";
	/** 机油压力 */
	public static final String THINGS_OilPressure = "OilPressure";
	/** 发动机厂家 1-杭发 2-上柴 */
	public static final String THINGS_EngineBrand = "EngineBrand";

	public enum EngineBrand{
		/**发动机厂家*/
		ENGINE_BRAND_CODE_1("1", "杭发"),
		ENGINE_BRAND_CODE_2("2", "上柴");

		/** code */
		private String code;
		/** 描述 */
		private String description;
		EngineBrand(String code, String description){
			this.code = code;
			this.description = description;
		}

		public static String getPrizeNameByNum(String code) {
			EngineBrand[] engineBrands = values();
			for (EngineBrand engineBrand : engineBrands) {
				if (engineBrand.getCode().equals(code)) {
					return engineBrand.getDescription();
				}
			}
			return null;
		}

		public String getCode() {
			return code;
		}

		public void setCode(String code) {
			this.code = code;
		}

		public String getDescription() {
			return description;
		}

		public void setDescription(String description) {
			this.description = description;
		}
	}
	/** 锁车状态 0 未绑定 1 绑定未锁车 2 限速 3 锁车 4-等待熄火锁车 */
	public static final String THINGS_lockStatus = "lockStatus";
	public enum LockStatus{
		/**锁车状态*/
		Lock_Status_CODE_0("0", "未绑定"),
		Lock_Status_CODE_1("1", "绑定未锁车"),
		Lock_Status_CODE_2("2", "限速"),
		Lock_Status_CODE_3("3", "锁车"),
		Lock_Status_CODE_4("4", "等待熄火锁车");

		/** code */
		private String code;
		/** 描述 */
		private String description;
		LockStatus(String code, String description){
			this.code = code;
			this.description = description;
		}

		public static String getPrizeNameByNum(String code) {
			LockStatus[] lockStatuses = values();
			for (LockStatus lockStatus : lockStatuses) {
				if (lockStatus.getCode().equals(code)) {
					return lockStatus.getDescription();
				}
			}
			return null;
		}

		public String getCode() {
			return code;
		}

		public void setCode(String code) {
			this.code = code;
		}

		public String getDescription() {
			return description;
		}

		public void setDescription(String description) {
			this.description = description;
		}
	}
	// 游客显示的thingsId
//	public static final String THINGS_ID_GUEST = "17010101683";  // 测试
	public static final String THINGS_ID_GUEST = "18201110265";  // 正式
	// 故障代码类型
	public static final String THINGS_FAULT_CODE_TYPE_SPN = "1";
	public static final String THINGS_FAULT_CODE_TYPE_FMI = "2";
	public static final String THINGS_FAULT_CODE_TYPE_EVENT = "3";
	// 故障代码
	public static final String THINGS_FAULT_CODE_SPN = "SPN";
	public static final String THINGS_FAULT_CODE_FMI = "FMI";
	// 灯
	public static final String THINGS_FAULT_CODE_LS = "LS";
	// 次数
	public static final String THINGS_FAULT_CODE_OC = "OC";
	// 历史
	public static final String THINGS_FAULT_CODE_HI = "LS";

	/** 灯故障枚举类 */
	public enum LsCodeEnum {
		/**故障描述*/
		LS_CODE_1("1", "保护灯状态"),
		LS_CODE_2("2", "琥珀色警告灯状态"),
		LS_CODE_3("3", "红色停止灯状态"),
		LS_CODE_4("4", "故障指示灯状态");
		/** 故障码 */
		private String code;
		/** 描述 */
		private String description;

		LsCodeEnum(String code, String description){
			this.code = code;
			this.description = description;
		}

		public String getCode() {
			return code;
		}

		public String getDescription() {
			return description;
		}

		public static String getPrizeNameByNum(String code) {
			LsCodeEnum[] lsCodeEnums = values();
			for (LsCodeEnum lsCodeEnum : lsCodeEnums) {
				if (lsCodeEnum.getCode().equals(code)) {
					return lsCodeEnum.getDescription();
				}
			}
			return null;
		}
	}
	/** 故障状态枚举类 */
	public enum HiCodeEnum {
		/**  故障描述 */
		HI_CODE_1("1", "实时故障代码"),
		HI_CODE_2("2", "历史故障代码"),
		HI_CODE_10("10", "实时事件代码"),
		HI_CODE_20("20", "历史事件代码");
		/**
		 * 故障码
		 */
		private String code;
		/**
		 * 描述
		 */
		private String description;

		HiCodeEnum(String code, String description) {
			this.code = code;
			this.description = description;
		}

		public String getCode() {
			return code;
		}

		public String getDescription() {
			return description;
		}

		public static String getDescriptionByCode(String code) {
			HiCodeEnum[] hiCodeEnums = values();
			for (HiCodeEnum hiCodeEnum : hiCodeEnums) {
				if (hiCodeEnum.getCode().equals(code)) {
					return hiCodeEnum.getDescription();
				}
			}
			return null;
		}
	}
	// ========================== 卡特故障分类 =============================
	/** 卡特故障分类 */
	public static String CAR_FALUT_TYPE_KT = "1";
	/** 钻通故障分类 */
	public static String CAR_FALUT_TYPE_ZT = "2";

	// ========================== 发布类型 =============================
	public static String publish_type_chushou = "出售";
	public static String publish_type_chuzu = "出租";
	public static String publish_type_qiugou = "求购";
	public static String publish_type_qiuzu = "求租";
	public static String publish_type_new_machine = "新机";
	public static String publish_type_weixiu = "维修服务";
	public static String publish_type_zhaopin = "企业招聘";
	public static String publish_type_qiuzhi = "个人求职";
	public static String publish_type_zhongbiao = "中标";
	public static String publish_type_zhaobiao = "招标";
	// ========================== 发布类型 枚举 =============================
	public enum PublishTypeEnum{
		/**
		 *
		 */
		publish_type_chushou("出售", "zowe_buyinfo_detail"),
		publish_type_chuzu("出租", "zowe_buyinfo_detail"),
		publish_type_qiugou("求购", "zowe_buyinfo_detail"),
		publish_type_qiuzu("求租", "zowe_buyinfo_detail"),
		publish_type_weixiu("维修服务", "publish_shop_info"),
		publish_type_zhaopin("企业招聘", "publish_recruit_info"),
		publish_type_qiuzhi("个人求职", "publish_jober_info"),
		publish_type_zhongbiao("中标", "zowe_project"),
		publish_type_zhaobiao("招标", "zowe_project");

		private String type;
		private String tableName;

		public String getType() {
			return type;
		}

		public void setType(String type) {
			this.type = type;
		}

		public String getTableName() {
			return tableName;
		}

		public void setTableName(String tableName) {
			this.tableName = tableName;
		}

		PublishTypeEnum(String type, String tableName){
			this.tableName = tableName;
			this.type = type;
		}

		public static String getTableNameByType(String type) {
			PublishTypeEnum[] publishTypeEnums = values();
			for (PublishTypeEnum publishTypeEnum : publishTypeEnums) {
				if (publishTypeEnum.getType().equals(type)) {
					return publishTypeEnum.getTableName();
				}
			}
			return null;
		}
		public static String getTypeByTableName(String tableName) {
			PublishTypeEnum[] publishTypeEnums = values();
			for (PublishTypeEnum publishTypeEnum : publishTypeEnums) {
				if (publishTypeEnum.getTableName().equals(tableName)) {
					return publishTypeEnum.getType();
				}
			}
			return null;
		}
	}


	// ==========================图片=============================
	public static String IMAGE_SHOW_PATH = "http://122.112.244.37:8080/springmvc";

	public static final String USER_PRE = "USER_PRE:";
	public static final long EXPIRE_TIME = 60;
	public static final String interface_account = "ZOWEUNION";
	public static final String unify_account = "e82444a08987594e11a55b29fef55ae42f4df9fa";

	// ==========================短信=============================
	public static String SMS_URL = "http://smssh1.253.com/msg/send/json";
	public static String SMS_UID = "N1056930";
	public static String SMS_KEY = "VZ4Wdwpa8";

	public static String[] dischargePattern = {"2G流量", "1G流量"};

	public static String[] mobileFirstPattern = {
			"134", "135", "136", "137", "138", "139", "147", "150", "151", "152", "157", "158", "159", "178", "182", "183", "184", "187", "188", "198",
			"130", "131", "132", "155", "156", "166", "185", "186", "145", "176",
			"133", "153", "177", "173", "180", "181", "189", "199"
	};

	public enum SharePrizeNnum {
		/**通过分享次数获取奖品名称*/
		share_prize_1(5, "10元现金红包"),
		share_prize_2(10, "30元现金红包"),
		share_prize_3(28, "配件满500减200优惠券（或50元现金红包）"),
		share_prize_4(38, "配件满1000减500优惠券（或100元现金红包）"),
		share_prize_5(50, "机修狮价值2000元在线协同工具免费使用半年（或200元现金红包）"),
		share_prize_6(100, "价值1799元机修狮盒子2套（或500元现金红包）");
		/** 分享成功次数 */
		private Integer num;
		/** 奖品名称 */
		private String prizeName;

		SharePrizeNnum(Integer num, String prizeName){
			this.num = num;
			this.prizeName = prizeName;
		}

		public Integer getNum() {
			return num;
		}

		public String getPrizeName() {
			return prizeName;
		}

		public static String getPrizeNameByNum(Integer num) {
			SharePrizeNnum[] sharePrizeNnums = values();
			for (SharePrizeNnum sharePrizeNnum : sharePrizeNnums) {
				if (sharePrizeNnum.getNum().equals(num)) {
					return sharePrizeNnum.getPrizeName();
				}
			}
			return null;
		}
	}

	public enum WorkTypeName {
		/** 招工类型 */
		type_name_1(1, "销售"),
		type_name_2(2, "学徒"),
		type_name_3(3, "机手"),
		type_name_4(4, "维修工");
		/** 分享成功次数 */
		private Integer num;
		/** 奖品名称 */
		private String typeName;
		WorkTypeName(Integer num, String typeName){
			this.num = num;
			this.typeName = typeName;
		}

		public Integer getNum() {
			return num;
		}

		public String getTypeName() {
			return typeName;
		}
		public static String getWorkTypeName(Integer num) {
			WorkTypeName[] workTypeNames = values();
			for (WorkTypeName workTypeName : workTypeNames) {
				if (workTypeName.getNum().equals(num)) {
					return workTypeName.getTypeName();
				}
			}
			return null;
		}
	}

	/**
	 * 用户上传文件目录分类
	 */
	public enum UploadFileFolder {
		/** 出售目录 */
		folder_chushou("1", "chushou"),
		/** 出租目录 */
		folder_chuzu("2", "chuzu"),
		/** 企业认证目录 */
		folder_enterprise_certification("3", "enterprise_certification"),
		/** 维修店铺目录 */
		folder_shop("4", "shop"),
		/** 工单 */
		folder_order("5", "order"),
		/** 车辆信息 */
		folder_car_info("6", "car_info"),
		/** banner图 */
		folder_banner("7", "banner"),
		/** 海报图 */
		folder_poster("8", "poster"),
		/** 还款的附件 */
		folder_repayment("9", "repaymentFile");

		private String code;
		private String folder;

		UploadFileFolder(String code, String folder) {
			this.code = code;
			this.folder = folder;
		}

		public static String getFolder(String code) {
			UploadFileFolder[] uploadFileFolders = values();
			for (UploadFileFolder uploadFileFolder : uploadFileFolders) {
				if (uploadFileFolder.getCode().equals(code)) {
					return uploadFileFolder.getFolder();
				}
			}
			return null;
		}

		public String getCode() {
			return code;
		}

		public void setCode(String code) {
			this.code = code;
		}

		public String getFolder() {
			return folder;
		}

		public void setFolder(String folder) {
			this.folder = folder;
		}
	}
	//=============================行为类型============================
	//招中标
	public static final int BEHAVIOR_BID_TYPE = 1;
	//求职招聘
	public static final int BEHAVIOR_RECRUIT_TYPE = 2;
	//租售
	public static final int BEHAVIOR_SALEANDRENT_TYPE = 3;
	//维修服务
	public static final int BEHAVIOR_SHOP_TYPE = 4;
	/**
	 * 用户行为和分数
	 */
	public enum UserBehaviorEnum{
		//进入列表
		BEHAVIOR_LIST(1,2),
		//进入某一条数据
		BEHAVIOR_DETAIL(2,5),
		//有筛选的搜索
		BEHAVIOR_SEARCH(3,8),
		//收藏一条数据
		BEHAVIOR_COLLECT(4,10),
		//分享一条数据
		BEHAVIOR_SHARE(5,12);

		private Integer behavior;
		private Integer score;

		UserBehaviorEnum(Integer behavior,Integer score){
			this.behavior = behavior;
			this.score = score;
		}

		public Integer getBehavior() {
			return behavior;
		}

		public void setBehavior(Integer behavior) {
			this.behavior = behavior;
		}

		public Integer getScore() {
			return score;
		}

		public void setScore(Integer score) {
			this.score = score;
		}

		public static Integer getScoreByBehavior(int behavior) {
			UserBehaviorEnum[] userBehaviorEnums = values();
			for (UserBehaviorEnum userBehaviorEnum : userBehaviorEnums) {
				if (userBehaviorEnum.getBehavior() == behavior) {
					return userBehaviorEnum.getScore();
				}
			}
			return null;
		}


		public enum ExceptionStatus {
			REPAIRARRIVE(1,"修工"),SUPPORTSTAFF(2,"客户满意"),REPAIR(3,"返修"),
			PARTSEXACT(4,"配件准确"),WAREHOUSERESPONSE(5,"响应时间");


			private Integer status;

			private String exception;

			ExceptionStatus(Integer status, String exception) {
				this.status = status;
				this.exception = exception;
			}

			public Integer getStatus() {
				return status;
			}

			public void setStatus(Integer status) {
				this.status = status;
			}

			public String getException() {
				return exception;
			}

			public void setException(String exception) {
				this.exception = exception;
			}
		}
	}

	//日志系统模块管理
	public enum OperationModel {
		PERSONMANAGEMENT(1,"人员管理"),
		OWNERMANAGEMENT(2,"车主管理"),
		LOCKCARMANAGEMENT(3,"锁车管理"),
		CARMANAGEMENT(4,"车辆管理");


		private Integer code;

		private String model;

		OperationModel(Integer code, String model) {
			this.code = code;
			this.model = model;
		}

		public static Integer getOperationModelCode(String model) {
			OperationModel[] operationModels = values();
			for (OperationModel operationModel : operationModels) {
				if (operationModel.getModel().equals(model)) {
					return operationModel.getCode();
				}
			}
			return null;
		}

		public Integer getCode() {
			return code;
		}

		public void setStatus(Integer code) {
			this.code = code;
		}

		public String getModel() {
			return model;
		}

		public void setModel(String model) {
			this.model = model;
		}
	}

	//日志系统操作类型管理
	public enum OperationType {
		ADDOPERATION(1,"新增"),
		DELETEOPERATION(2,"删除"),
		EDITOPERATION(3,"编辑"),
		BANOPERATION(4,"停用"),
		LOCKCAROPERATION(5,"锁车"),
		UNLOCKCAROPERATION(6,"解锁"),
		RECOVEROPERATION(7,"启用");


		private Integer code;

		private String type;

		OperationType(Integer code, String type) {
			this.code = code;
			this.type = type;
		}

		public static Integer getOperationTypeCode(String type) {
			OperationType[] operationTypes = values();
			for (OperationType operationType : operationTypes) {
				if (operationType.getType().equals(type)) {
					return operationType.getCode();
				}
			}
			return null;
		}

		public Integer getCode() {
			return code;
		}

		public void setStatus(Integer code) {
			this.code = code;
		}

		public String getType() {
			return type;
		}

		public void setType(String type) {
			this.type = type;
		}
	}

	//日志系统操作类型管理
	public enum LogType {
		ADDOPERATION(1,"登录"),
		DELETEOPERATION(2,"操作");


		private Integer code;

		private String type;

		LogType(Integer code, String type) {
			this.code = code;
			this.type = type;
		}

		public static Integer getLogTypeCode(String type) {
			LogType[] logTypes = values();
			for (LogType logType : logTypes) {
				if (logType.getType().equals(type)) {
					return logType.getCode();
				}
			}
			return null;
		}

		public Integer getCode() {
			return code;
		}

		public void setStatus(Integer code) {
			this.code = code;
		}

		public String getType() {
			return type;
		}

		public void setType(String type) {
			this.type = type;
		}
	}

	public static boolean is18Or19(String things_id) {

		if (things_id.length() > 0) {

			char oneStr = things_id.charAt(0);
			char twoStr = things_id.charAt(1);

			if (oneStr == '1' && twoStr == '8') {

				return true;
			}
			if (oneStr == '1' && twoStr == '9') {

				return true;
			}
		}

		return false;
	}

	/**
	 * 判断是否是192808编码(该编码开头的为定位设备)开头的thingsid
	 * @param things_id
	 * @return
	 */
	public static boolean is192808(String things_id) {
		boolean result = false;
		if (things_id.length() > 0) {
			String prefixPart = things_id.substring(0, 6);
			if(prefixPart.equals("192808")) {
				result = true;
			}
		}

		return result;
	}

	// CanID类型声明 - 电车
	public static String MOTORCONTROLLERMESSAGE_F105 = "AAF105";  // 整车控制器报文1（主电机状态、油门给定、制动深度给定等）
	public static String MOTORCONTROLLERMESSAGE_E105 = "AAE105";  // 整车控制器报文2（泵电机状态、油门给定、制动深度给定等）

	public static String MOTORCONTROLLERMESSAGE_F106 = "AAF106";  // 整车控制器报文3（档位信息）
	public static String MOTORCONTROLLERMESSAGE_F205 = "AAF205";  // 整车控制器报文4（车速、压力、变矩器油温、VCU心跳信号）

	public static String MOTORCONTROLLERMESSAGE_FF05 = "AAFF05";  // 整车控制器报文5（国家平台符合性检测用）
	public static String MOTORCONTROLLERMESSAGE_F18D = "AAF18D";  // 电机控制器报文3（主电机温度、控制器温度、报警）

	public static String MOTORCONTROLLERMESSAGE_F120 = "AAF120";  // 电机控制器报文4（主电机母线电压、电流、实时功率）
	public static String MOTORCONTROLLERMESSAGE_E18D = "AAE18D"; // 电机控制器报文5（泵电机温度、控制器温度、报警）

	public static String MOTORCONTROLLERMESSAGE_E120 = "AAE120"; // 电机控制器报文6（泵电机母线电压、电流、实时功率）

	public static String MOTORCONTROLLERMESSAGE_FF19 = "AAFF19";  // 电池管理系统报文二（总电流，总电压）

	public static String MOTORCONTROLLERMESSAGE_F11F = "AAF11F"; // 主电机输出转矩，电机转速，当前电机的实际运行状态
	public static String MOTORCONTROLLERMESSAGE_E11F = "AAE11F"; // 泵电机输出转矩，电机转速，当前电机的实际运行状态

	public static String MOTORCONTROLLERMESSAGE_84D0 = "AA84D0"; // BMS 发送电池包信息
	public static String MOTORCONTROLLERMESSAGE_3201 = "AA3201"; // DC-DC故障

	public static String MOTORCONTROLLERMESSAGE_3301 = "AA3301"; // 空压机状态
	public static String MOTORCONTROLLERMESSAGE_3401 = "AA3401"; // 油泵状态

	public static String MOTORCONTROLLERMESSAGE_FF20 = "AAFF20"; // 充电情况
	public static String MOTORCONTROLLERMESSAGE_E5D0 = "AAE5D0"; // 电池信息

	public static String MOTORCONTROLLERMESSAGE_F1D0 = "AAF1D0"; // 电池包充放电量信息
	public static String MOTORCONTROLLERMESSAGE_FF21 = "AAFF21"; // 电池管理系统

	public static String MOTORCONTROLLERMESSAGE_C2D0 = "AAC2D0"; // 电池各温度信息
	public static String MOTORCONTROLLERMESSAGE_C1D0 = "AAC1D0"; // 电池电芯电压

	public static String MOTORCONTROLLERMESSAGE_FF24 = "AAFF24"; // 电池管理系统报文七（铅蓄电池）
	public static String MOTORCONTROLLERMESSAGE_E6D0 = "AAE6D0"; // 电池信息 2(电池系统中 CSC 信息)
}